package com.fhz.room;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

/**
 * 时间:2023/8/16
 *
 * @author Mr.Feng
 * 简述: TODO
 */
@Dao
public interface UserDao {
    @Query("SELECT * FROM user")
    List<User> getAll();

    @Insert
    void insertAll(User... users);

    @Update
    void updateUser(User user);

    @Delete
    void delete(User user);

    @Query("SELECT * FROM user WHERE uid IN (:userIds)")
    List<User> loadAllByIds(int[] userIds);

    @Query("SELECT * FROM user WHERE uid = :id")
    User findUserById(int id);

    @Query("SELECT * FROM user where first_name = :name and lastName = :pwd ")
    User findUserByNameAndPwd(String name,String pwd);

    @Query("SELECT * FROM user WHERE first_name LIKE :first")
    List<User> findByName(String first);
//
//    @Insert
//    void insertAll(User... users);
//
//    @Delete
//    void delete(User user);
}   
